package com.baidu.controller;

import com.baidu.model.vo.Result;;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/resume")
public class ResumeController {

    /**
     * HttpServletRequest - 所有来自于客户端的请求的信息全部被封装到了这个对象中
     * @param request
     * @return
     */
    @GetMapping("/search")
    @ResponseBody
    public Result collect(HttpServletRequest request){
//        String token = request.getHeader("token");
//
//        //解析token
//        Claims claims = JWTUtils.checkJWT(token.replace("aistar",""));
//
//        //获取用户的用户名
//        Integer userId = claims.get("id",Integer.class);
//        String email = claims.get("email",String.class);
//        System.out.println(userId+":"+email);

        Integer userId = (Integer) request.getAttribute("userId");

        System.out.println("userId:"+userId);

        return new Result("200","我的收藏",userId);
    }
}